Many database systems allow the use of additional user-defined functions, procedures or routines (generally referred to herein as “user-defined extensions” or “UDE”) to call or invoke routines that run in a separate process. As one illustrative example (to be used throughout this disclosure), some structured query language (SQL) database systems allow users to create or define procedures or routines to extend the functionality of the SQL system. In some SQL database systems, the routines are created in an object-oriented programming language such as C/C++. The routines are compiled and identified to the database system as new functions or procedures so that the database system will recognize the new function. This allows the UDE function to be invoked similar to a native SQL database function. For example, when a UDE function is invoked, the database server may cause a separate UDE process or UDE server to be run to perform the function.
The utility of these user-defined extensions can be further enhanced by allowing them to recursively interact with the database server. For example, an initial SQL database request may invoke a first UDE function (thereby causing a separate process to run). The UDE function may in turn request services from the database server. In some situations, the database request may consist of a call to a stored procedure invoking a further UDE function. Unfortunately, when the UDE server or process communicates with the database server to request services, a new session object is typically created (as well as a new call stack to track the new session). That is, for every level of recursion, current systems create a new session object (and a new call stack). The creation of each new session object and call stack can impair system performance and reduce the number of available stacks and memory.
It would be desirable to provide improved systems and methods for implementing recursive remote procedure calls.